package com.hospital.billcommon.module.filter;

import com.hospital.common.core.module.entity.ChargeSpecialExceptDict;
import com.hospital.common.core.module.entity.ChargeSpecialItemDict;
import com.hospital.common.core.module.entity.query.BillItem;

import java.util.ArrayList;
import java.util.List;

/**
 * @description 折扣过滤器链
 * @author: liuwei
 * @create 2020/5/14 10:56 上午
 **/
public class FilterChain {

    private List<CutOff> filterList=new ArrayList<>();


    public FilterChain addFilter(CutOff filter){
        this.filterList.add(filter);
        return this;
    }

    public FilterChain addFilters(List<CutOff> fliters){
        this.filterList.addAll(fliters);
        return this;
    }

    public void doFilter(List<? extends BillItem> billItems, String chargetype, String outp,List<ChargeSpecialItemDict> chargeSpecialItemDicts ,List<ChargeSpecialExceptDict> chargeSpecialExceptDicts){
        if(this.filterList!=null&&this.filterList.size()>0){
            for (CutOff cutOff:filterList){
                cutOff.executeCutOff(billItems,chargetype,outp,chargeSpecialItemDicts,chargeSpecialExceptDicts);
            }
        }
    }
}
